package com.noble.library.third.TencentAI;

import com.noble.library.third.TencentAI.face.TAipFace;

/**
 * 腾讯AI相关接口使用
 * Created by Su on 2018/8/1.
 */
public class TencentAIUtil {
    private static final String APP_ID = "1107151207";
    private static final String APP_KEY = "a8LuAKWPeJTJobkV";

    private static TAipFace aipFace;

    // ===================================== 人脸识别检测 ============================================

    /**
     * @param filePath 图片文件路径
     */
    public static void checkFace(String filePath, TAiCallback callback) {
        if (aipFace == null) {
            aipFace = new TAipFace(APP_ID, APP_KEY);
        }
        try {
            aipFace.detect(filePath, callback);
        } catch (Exception e) {
            e.printStackTrace();
            if (callback != null){
                callback.onResult("");
            }
        }
    }


    // ======================================= TencentAI 反馈数据回调 ============================
    public interface TAiCallback {
        void onResult(String result);
    }
}
